package com.hl.payServer.task;


import com.hl.payServer.util.DateUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

@Component
public class TaskTest {
    private final Logger log = LoggerFactory.getLogger(TaskTest.class);
    //输出时间格式

    @Scheduled(cron = "0/15 * * * * ? ")
    private void sayHello(){
        String dateTime = DateUtil.getNowTime("yyyy-MM-dd hh:mm:ss:sss");
        log.info("{} 向宇宙发出了一声问候: Hello World!", dateTime);
        try {
            Thread.sleep(10000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }

    @Scheduled(cron = "0/16 * * * * ? ")
    private void sayHello2(){
        String dateTime = DateUtil.getNowTime("yyyy-MM-dd hh:mm:ss:sss");
        log.info("{} 向宇宙发出了一声问候: 你好,世界", dateTime);
    }


}
